<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>购物车</title>
    <link rel="stylesheet" href="__PUBLIC__/home/css/carts.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/payment.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/css.css">
</head>
<include file="Public:left"/>
<body>
<div id="cont">
    <include file="Public:header"/>
    <section class="cartMain">
        <div class="cartMain_hd">
            <ul class="order_lists cartTop">
                <li class="list_chk">
                    <!--所有商品全选-->
                    <input type="checkbox" id="all" class="whole_check">
                    <label for="all"></label>
                    全选
                </li>
                <li class="list_con">商品信息</li>
                <li class="list_price">单价</li>
                <li class="list_amount">数量</li>
                <li class="list_sum">金额</li>
                <li class="list_op">操作</li>
            </ul>
        </div>

        <div class="cartBox">
            <div class="shop_info">
            </div>

            <div class="order_content">
                <volist name="lst" id="vo">
                    <ul class="order_lists">
                        <li class="list_chk">
                            <input type="checkbox" id="checkbox_{$vo.id}" class="son_check">
                            <label for="checkbox_{$vo.id}"></label>
                            <input type="hidden" name="id" value="{$vo.id}">
                        </li>
                        <li class="list_con">
                            <div class="list_img"><a href="__MODULE__/Details/details/id/{$vo.id}"><img src="{$vo.goods_pic}"
                                                                                                alt=""></a></div>
                            <div class="list_text"><a href="__MODULE__/Details/details/id/{$vo.id}">{$vo.goods_title}</a></div>
                        </li>
                        <li class="list_price">
                            <p class="price">￥{$vo.goods_price}</p>
                        </li>
                        <li class="list_amount">
                            <div class="amount_box">
                                <a href="javascript:;" class="reduce reSty">-</a>
                                <input type="text" value="1" class="sum">
                                <a href="javascript:;" class="plus">+</a>
                            </div>
                        </li>
                        <li class="list_sum">
                            <p class="sum_price">￥{$vo.goods_price}</p>
                        </li>
                        <li class="list_op">
                            <p class="del"><a href="javascript:;" class="delBtn">移除商品</a></p>
                        </li>
                    </ul>
                </volist>
            </div>
            <div class="bar-wrapper">
                <div class="bar-right">
                    <div class="piece">已选商品<strong class="piece_num">0</strong>件</div>
                    <div class="totalMoney">共计: <strong class="total_text">0.00</strong></div>
                    <div class="calBtn"><a href="javascript:;">结算</a></div>
                </div>
            </div>

        </div>
        <!--底部-->

    </section>

    <section class="model_bg"></section>
    <section class="my_model">
        <p class="title">删除宝贝<span class="closeModel">X</span></p>
        <p>您确认要删除该宝贝吗？</p>
        <div class="opBtn"><a href="javascript:;" class="dialog-sure">确定</a><a href="javascript:;" class="dialog-close">关闭</a>
        </div>
    </section>
</div>
</body>

<script src="__PUBLIC__/home/js/jquery-1.11.0.min.js"></script>
<script src="__PUBLIC__/home/js/carts.js"></script>
<script>
    $(function () {
        // @TODO 删除购物车商品
        var $order_lists = null;
        var $order_content = '';
        var data = {};
        $('.delBtn').click(function () {
            $order_lists = $(this).parents('.order_lists');
            $order_content = $order_lists.parents('.order_content');
            $('.model_bg').fadeIn(300);
            $('.my_model').fadeIn(300);
        });

        //关闭模态框
        $('.closeModel').click(function () {
            closeM();
        });
        $('.dialog-close').click(function () {
            closeM();
        });

        function closeM() {
            $('.model_bg').fadeOut(300);
            $('.my_model').fadeOut(300);
        }

        //获取商品id
        data.id = $('input[name="id"]').val();
        //确定按钮，移除商品
        $('.dialog-sure').click(function () {
            $order_lists.remove();
            $.post("{:U('Cart/del')}", data, function (ret) {
            })
            if ($order_content.html().trim() == null || $order_content.html().trim().length == 0) {
                $order_content.parents('.cartBox').remove();
            }
            closeM();
            $sonCheckBox = $('.son_check');
        })
    })
</script>
</html>